package com.everflourish.yeah100.entity.clazz;

import com.everflourish.yeah100.entity.marking.Student;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;

/**
 * 班级
 * 
 * @author pf
 * @date 2015-4-16
 */
public class ClassManage implements Serializable {

	private static final long serialVersionUID = 9164471489775972799L;

	private String id; // id
	private String rosterClassId;
	private String name; // 班级名称
	private Integer size = 0; // 班级大小
	private String imagePath = ""; // 班级头像的路径
	private String classNo; // 班号
	private String sharingNo; // 共享号
	private String createTime; // 创建时间
	private ArrayList<Student> students; // 学生集合

	public Integer getSize() {
		return size;
	}

	public String getRosterClassId() {
		return rosterClassId;
	}


	public void setRosterClassId(String rosterClassId) {
		this.rosterClassId = rosterClassId;
	}


	public void setSize(Integer size) {
		this.size = size;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getImagePath() {
		return imagePath;
	}

	public void setImagePath(String imagePath) {
		this.imagePath = imagePath;
	}

	public String getClassNo() {
		return classNo;
	}

	public void setClassNo(String classNo) {
		this.classNo = classNo;
	}

	public String getSharingNo() {
		return sharingNo;
	}

	public void setSharingNo(String sharingNo) {
		this.sharingNo = sharingNo;
	}

	public String getCreateTime() {
		return createTime;
	}

	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}

	public ArrayList<Student> getStudents() {
		return students;
	}

	public void setStudents(ArrayList<Student> students) {
		this.students = students;
	}

	public Object deepCopy() {
		ObjectInputStream ois;
		try {
			// 将该对象序列化成流,因为写在流里的是对象的一个拷贝，而原对象仍然存在于JVM里面。所以利用这个特性可以实现对象的深拷贝
			ByteArrayOutputStream bos = new ByteArrayOutputStream();
			ObjectOutputStream oos = new ObjectOutputStream(bos);
			oos.writeObject(this);
			// 将流序列化成对象
			ByteArrayInputStream bis = new ByteArrayInputStream(
					bos.toByteArray());
			ois = new ObjectInputStream(bis);
			return ois.readObject();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
}
